home *** CD-ROM | disk | FTP | other *** search
- head 1.5;
- branch ;
- access ;
- symbols ;
- locks ; strict;
- comment @ * @;
-
-
- 1.5
- date 89.12.11.11.08.56; author mgbaker; state Exp;
- branches ;
- next 1.4;
-
- 1.4
- date 88.07.29.18.30.14; author ouster; state Exp;
- branches ;
- next 1.3;
-
- 1.3
- date 88.07.28.17.57.18; author ouster; state Exp;
- branches ;
- next 1.2;
-
- 1.2
- date 88.07.25.13.29.11; author ouster; state Exp;
- branches ;
- next 1.1;
-
- 1.1
- date 88.06.20.09.30.18; author ouster; state Exp;
- branches ;
- next ;
-
-
- desc
- @@
-
-
- 1.5
- log
- @Fixed bug for multiple word keys where it would return the opposite
- of whether it matched on it or not.
- @
- text
- @/*
- * HashChainSearch.c --
- *
- * Source code for HashChainSearch, a utility procedure used by
- * the hash table library.
- *
- * Copyright 1988 Regents of the University of California
- * Permission to use, copy, modify, and distribute this
- * software and its documentation for any purpose and without
- * fee is hereby granted, provided that the above copyright
- * notice appear in all copies. The University of California
- * makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without
- * express or implied warranty.
- */
-
- #ifndef lint
- static char rcsid[] = "$Header: /sprite/src/lib/c/hash/RCS/HashChainSearch.c,v 1.4 88/07/29 18:30:14 ouster Exp Locker: mgbaker $ SPRITE (Berkeley)";
- #endif not lint
-
- #include "hash.h"
- #include "list.h"
-
- /*
- *---------------------------------------------------------
- *
- * HashChainSearch --
- *
- * Search the hash table for the entry in the hash chain.
- *
- * Results:
- * Pointer to entry in hash chain, NULL if none found.
- *
- * Side Effects:
- * None.
- *
- *---------------------------------------------------------
- */
-
- Hash_Entry *
- HashChainSearch(tablePtr, key, hashList)
- Hash_Table *tablePtr; /* Hash table to search. */
- register Address key; /* A hash key. */
- register List_Links *hashList;
- {
- register Hash_Entry *hashEntryPtr;
- register int *hashKeyPtr;
- int *keyPtr;
- register int numKeys;
-
- numKeys = tablePtr->keyType;
- LIST_FORALL(hashList, (List_Links *) hashEntryPtr) {
- switch (numKeys) {
- case 0:
- if (strcmp(hashEntryPtr->key.name, key) == 0) {
- return(hashEntryPtr);
- }
- break;
- case 1:
- if (hashEntryPtr->key.ptr == key) {
- return(hashEntryPtr);
- }
- break;
- case 2:
- hashKeyPtr = hashEntryPtr->key.words;
- keyPtr = (int *) key;
- if (*hashKeyPtr++ == *keyPtr++ && *hashKeyPtr == *keyPtr) {
- return(hashEntryPtr);
- }
- break;
- default:
- if (!bcmp((char *) hashEntryPtr->key.words,
- (char *) key, numKeys * sizeof(int))) {
- return(hashEntryPtr);
- }
- break;
- }
- }
-
- /*
- * The desired entry isn't there
- */
-
- return ((Hash_Entry *) NULL);
- }
- @
-
-
- 1.4
- log
- @Bug in lint cleanupl.
- @
- text
- @d18 1
- a18 1
- static char rcsid[] = "$Header: HashChainSearch.c,v 1.3 88/07/28 17:57:18 ouster Exp $ SPRITE (Berkeley)";
- d72 1
- a72 1
- if (bcmp((char *) hashEntryPtr->key.words,
- @
-
-
- 1.3
- log
- @Lint.
- @
- text
- @d18 1
- a18 1
- static char rcsid[] = "$Header: HashChainSearch.c,v 1.2 88/07/25 13:29:11 ouster Exp $ SPRITE (Berkeley)";
- d73 1
- a73 1
- (char *) key), numKeys * sizeof(int)) {
- @
-
-
- 1.2
- log
- @Forgot to change procedure's name.
- @
- text
- @d18 1
- a18 1
- static char rcsid[] = "$Header: HashChainSearch.c,v 1.1 88/06/20 09:30:18 ouster Exp $ SPRITE (Berkeley)";
- d72 2
- a73 2
- if (bcmp((Address) hashEntryPtr->key.words,
- (Address) key), numKeys * sizeof(int)) {
- @
-
-
- 1.1
- log
- @Initial revision
- @
- text
- @d18 1
- a18 1
- static char rcsid[] = "$Header: proto.c,v 1.2 88/03/11 08:39:08 ouster Exp $ SPRITE (Berkeley)";
- d27 1
- a27 1
- * ChainSearch --
- d40 2
- a41 2
- static Hash_Entry *
- ChainSearch(tablePtr, key, hashList)
- @
-